package GoodsBaseService

import (
	"context"
	"gdshop-font-api-go/app/response/GoodsResp"
	"github.com/gogf/gf/util/gconv"
)

func HandleDetails(ctx context.Context, item *GoodsResp.Details, isGetThumbs bool, limit int) {
	// 取出规格
	item.Options = GetGoodsOptionsByGoodsId(ctx, int(item.Id), limit)
	if len(item.Options) > 0 {
		item.SellPrice = item.Options[0].SellPrice
		item.MarketPrice = item.Options[0].MarketPrice
	}
	// 读取产品图
	if isGetThumbs {
		item.ThumbsArr = GetGoodsThumbsByGoodsId(ctx, gconv.String(item.Id), "")
	}
}
